package com.ud.smp.search.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ud.smp.search.entity.Series;
import com.ud.smp.search.mapper.SeriesDAO;
import com.ud.smp.search.service.SeriesService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.sql.Wrapper;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author wendal
 * @since 2021-09-25
 */
@Service
public class SeriesServiceImpl extends ServiceImpl<SeriesDAO, Series> implements SeriesService {

    @Autowired
    private SeriesDAO seriesDAO;

    @Override
    public void searchTest(){
        Long startTime = System.currentTimeMillis();
        IPage<Series> page = new Page<>(1, 20);
        //查询条件，如eq ,orderby 等等，具体可以看官方文档
        QueryWrapper<Series> userQueryWrapper = new QueryWrapper<>();
        //这里的page就是上面的分页条件
        IPage<Series> seriesIPage = seriesDAO.selectPage(page, userQueryWrapper);
        System.out.println(seriesIPage.getTotal());
        System.out.println(seriesIPage.getPages());
        System.out.println(seriesIPage.getCurrent());
        System.out.println(seriesIPage.getSize());
        System.out.println(System.currentTimeMillis() - startTime);
    }

}
